.class Ljavax/microedition/lcdui/TimeCanvas;
.super Ljavax/microedition/lcdui/Canvas;
.source "DateField.java"


# instance fields
.field cal:Ljava/util/Calendar;

.field private hours:I

.field private minutes:I

.field private selected:I


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 476
    invoke-direct {p0}, Ljavax/microedition/lcdui/Canvas;-><init>()V

    .line 477
    invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;

    move-result-object v0

    iput-object v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->cal:Ljava/util/Calendar;

    .line 478
    return-void
.end method


# virtual methods
.method public getTime()Ljava/util/Date;
    .locals 3

    .prologue
    .line 481
    iget-object v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->cal:Ljava/util/Calendar;

    const/16 v1, 0xb

    iget v2, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 482
    iget-object v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->cal:Ljava/util/Calendar;

    const/16 v1, 0xc

    iget v2, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    invoke-virtual {v0, v1, v2}, Ljava/util/Calendar;->set(II)V

    .line 483
    iget-object v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->cal:Ljava/util/Calendar;

    invoke-virtual {v0}, Ljava/util/Calendar;->getTime()Ljava/util/Date;

    move-result-object v0

    return-object v0
.end method

.method public declared-synchronized keyPressed(I)V
    .locals 5
    .parameter "keycode"

    .prologue
    const/16 v4, 0x3b

    const/16 v3, 0x17

    const/4 v2, 0x1

    .line 561
    monitor-enter p0

    :try_start_0
    invoke-virtual {p0, p1}, Ljavax/microedition/lcdui/TimeCanvas;->getGameAction(I)I

    move-result v0

    .line 563
    .local v0, k:I
    const/4 v1, 0x2

    if-ne v0, v1, :cond_1

    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    if-lez v1, :cond_1

    .line 564
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    sub-int/2addr v1, v2

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    .line 565
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TimeCanvas;->repaint()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 598
    :cond_0
    :goto_0
    monitor-exit p0

    return-void

    .line 566
    :cond_1
    const/4 v1, 0x5

    if-ne v0, v1, :cond_2

    :try_start_1
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    if-ge v1, v2, :cond_2

    .line 567
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    .line 568
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TimeCanvas;->repaint()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 561
    .end local v0           #k:I
    :catchall_0
    move-exception v1

    monitor-exit p0

    throw v1

    .line 569
    .restart local v0       #k:I
    :cond_2
    if-ne v0, v2, :cond_4

    .line 570
    :try_start_2
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    packed-switch v1, :pswitch_data_0

    .line 582
    :cond_3
    :goto_1
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TimeCanvas;->repaint()V

    goto :goto_0

    .line 572
    :pswitch_0
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    .line 573
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    if-le v1, v3, :cond_3

    .line 574
    const/4 v1, 0x0

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    goto :goto_1

    .line 577
    :pswitch_1
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    .line 578
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    if-le v1, v4, :cond_3

    .line 579
    const/4 v1, 0x0

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    goto :goto_1

    .line 583
    :cond_4
    const/4 v1, 0x6

    if-ne v0, v1, :cond_0

    .line 584
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    packed-switch v1, :pswitch_data_1

    .line 596
    :cond_5
    :goto_2
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TimeCanvas;->repaint()V

    goto :goto_0

    .line 586
    :pswitch_2
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    sub-int/2addr v1, v2

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    .line 587
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    if-gez v1, :cond_5

    .line 588
    const/16 v1, 0x17

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    goto :goto_2

    .line 591
    :pswitch_3
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    sub-int/2addr v1, v2

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    .line 592
    iget v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    if-gez v1, :cond_5

    .line 593
    const/16 v1, 0x3b

    iput v1, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_2

    .line 570
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
    .end packed-switch

    .line 584
    :pswitch_data_1
    .packed-switch 0x0
        :pswitch_2
        :pswitch_3
    .end packed-switch
.end method

.method public paint(Ljavax/microedition/lcdui/Graphics;)V
    .locals 25
    .parameter "g"

    .prologue
    .line 494
    invoke-virtual/range {p0 .. p0}, Ljavax/microedition/lcdui/TimeCanvas;->getWidth()I

    move-result v20

    .line 495
    .local v20, w:I
    invoke-virtual/range {p0 .. p0}, Ljavax/microedition/lcdui/TimeCanvas;->getHeight()I

    move-result v11

    .line 497
    .local v11, h:I
    const v22, 0xffffff

    move-object/from16 v0, p1

    move/from16 v1, v22

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Graphics;->setColor(I)V

    .line 498
    const/16 v22, 0x0

    const/16 v23, 0x0

    move-object/from16 v0, p1

    move/from16 v1, v22

    move/from16 v2, v23

    move/from16 v3, v20

    move v4, v11

    invoke-virtual {v0, v1, v2, v3, v4}, Ljavax/microedition/lcdui/Graphics;->fillRect(IIII)V

    .line 500
    const/16 v22, 0x20

    const/16 v23, 0x1

    const/16 v24, 0x0

    invoke-static/range {v22 .. v24}, Ljavax/microedition/lcdui/Font;->getFont(III)Ljavax/microedition/lcdui/Font;

    move-result-object v10

    .line 503
    .local v10, font:Ljavax/microedition/lcdui/Font;
    move-object/from16 v0, p0

    iget v0, v0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    move/from16 v22, v0

    invoke-static/range {v22 .. v22}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;

    move-result-object v13

    .line 504
    .local v13, hoursStr:Ljava/lang/String;
    move-object/from16 v0, p0

    iget v0, v0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    move/from16 v22, v0

    const/16 v23, 0xa

    move/from16 v0, v22

    move/from16 v1, v23

    if-ge v0, v1, :cond_0

    .line 505
    new-instance v22, Ljava/lang/StringBuffer;

    invoke-direct/range {v22 .. v22}, Ljava/lang/StringBuffer;-><init>()V

    const-string v23, "0"

    invoke-virtual/range {v22 .. v23}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v22

    move-object/from16 v0, v22

    move-object v1, v13

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v22

    invoke-virtual/range {v22 .. v22}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v13

    .line 506
    :cond_0
    move-object/from16 v0, p0

    iget v0, v0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    move/from16 v22, v0

    invoke-static/range {v22 .. v22}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;

    move-result-object v16

    .line 507
    .local v16, minutesStr:Ljava/lang/String;
    move-object/from16 v0, p0

    iget v0, v0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    move/from16 v22, v0

    const/16 v23, 0xa

    move/from16 v0, v22

    move/from16 v1, v23

    if-ge v0, v1, :cond_1

    .line 508
    new-instance v22, Ljava/lang/StringBuffer;

    invoke-direct/range {v22 .. v22}, Ljava/lang/StringBuffer;-><init>()V

    const-string v23, "0"

    invoke-virtual/range {v22 .. v23}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v22

    move-object/from16 v0, v22

    move-object/from16 v1, v16

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v22

    invoke-virtual/range {v22 .. v22}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v16

    .line 509
    :cond_1
    const-string v8, " : "

    .line 511
    .local v8, delimiterStr:Ljava/lang/String;
    invoke-virtual {v10}, Ljavax/microedition/lcdui/Font;->getHeight()I

    move-result v22

    sub-int v22, v11, v22

    ushr-int/lit8 v21, v22, 0x1

    .line 513
    .local v21, y:I
    invoke-virtual {v10, v13}, Ljavax/microedition/lcdui/Font;->stringWidth(Ljava/lang/String;)I

    move-result v14

    .line 514
    .local v14, hoursW:I
    move-object v0, v10

    move-object/from16 v1, v16

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Font;->stringWidth(Ljava/lang/String;)I

    move-result v17

    .line 515
    .local v17, minutesW:I
    invoke-virtual {v10, v8}, Ljavax/microedition/lcdui/Font;->stringWidth(Ljava/lang/String;)I

    move-result v9

    .line 517
    .local v9, delimiterW:I
    add-int v22, v14, v17

    add-int v19, v22, v9

    .line 518
    .local v19, stringWidth:I
    sub-int v22, v20, v19

    ushr-int/lit8 v18, v22, 0x1

    .line 519
    .local v18, offset:I
    move/from16 v12, v18

    .line 520
    .local v12, hOff:I
    add-int v7, v18, v14

    .line 521
    .local v7, dOff:I
    add-int v15, v7, v9

    .line 523
    .local v15, mOff:I
    const/16 v22, 0x0

    move-object/from16 v0, p1

    move/from16 v1, v22

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Graphics;->setColor(I)V

    .line 524
    move-object/from16 v0, p1

    move-object v1, v10

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Graphics;->setFont(Ljavax/microedition/lcdui/Font;)V

    .line 526
    const/16 v22, 0x14

    move-object/from16 v0, p1

    move-object v1, v8

    move v2, v7

    move/from16 v3, v21

    move/from16 v4, v22

    invoke-virtual {v0, v1, v2, v3, v4}, Ljavax/microedition/lcdui/Graphics;->drawString(Ljava/lang/String;III)V

    .line 533
    move-object/from16 v0, p0

    iget v0, v0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    move/from16 v22, v0

    if-nez v22, :cond_2

    .line 534
    const/4 v5, 0x0

    .line 535
    .local v5, colorR:I
    const v6, 0xffffff

    .line 541
    .local v6, colorT:I
    :goto_0
    move-object/from16 v0, p1

    move v1, v5

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Graphics;->setColor(I)V

    .line 542
    invoke-virtual {v10}, Ljavax/microedition/lcdui/Font;->getHeight()I

    move-result v22

    move-object/from16 v0, p1

    move v1, v12

    move/from16 v2, v21

    move v3, v14

    move/from16 v4, v22

    invoke-virtual {v0, v1, v2, v3, v4}, Ljavax/microedition/lcdui/Graphics;->fillRect(IIII)V

    .line 543
    move-object/from16 v0, p1

    move v1, v6

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Graphics;->setColor(I)V

    .line 544
    const/16 v22, 0x14

    move-object/from16 v0, p1

    move-object v1, v13

    move v2, v12

    move/from16 v3, v21

    move/from16 v4, v22

    invoke-virtual {v0, v1, v2, v3, v4}, Ljavax/microedition/lcdui/Graphics;->drawString(Ljava/lang/String;III)V

    .line 546
    move-object/from16 v0, p0

    iget v0, v0, Ljavax/microedition/lcdui/TimeCanvas;->selected:I

    move/from16 v22, v0

    const/16 v23, 0x1

    move/from16 v0, v22

    move/from16 v1, v23

    if-ne v0, v1, :cond_3

    .line 547
    const/4 v5, 0x0

    .line 548
    const v6, 0xffffff

    .line 554
    :goto_1
    move-object/from16 v0, p1

    move v1, v5

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Graphics;->setColor(I)V

    .line 555
    invoke-virtual {v10}, Ljavax/microedition/lcdui/Font;->getHeight()I

    move-result v22

    move-object/from16 v0, p1

    move v1, v15

    move/from16 v2, v21

    move/from16 v3, v17

    move/from16 v4, v22

    invoke-virtual {v0, v1, v2, v3, v4}, Ljavax/microedition/lcdui/Graphics;->fillRect(IIII)V

    .line 556
    move-object/from16 v0, p1

    move v1, v6

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Graphics;->setColor(I)V

    .line 557
    const/16 v22, 0x14

    move-object/from16 v0, p1

    move-object/from16 v1, v16

    move v2, v15

    move/from16 v3, v21

    move/from16 v4, v22

    invoke-virtual {v0, v1, v2, v3, v4}, Ljavax/microedition/lcdui/Graphics;->drawString(Ljava/lang/String;III)V

    .line 558
    return-void

    .line 537
    .end local v5           #colorR:I
    .end local v6           #colorT:I
    :cond_2
    const v5, 0xffffff

    .line 538
    .restart local v5       #colorR:I
    const/4 v6, 0x0

    .restart local v6       #colorT:I
    goto :goto_0

    .line 550
    :cond_3
    const v5, 0xffffff

    .line 551
    const/4 v6, 0x0

    goto :goto_1
.end method

.method public setTime(Ljava/util/Date;)V
    .locals 2
    .parameter "time"

    .prologue
    .line 487
    iget-object v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->cal:Ljava/util/Calendar;

    invoke-virtual {v0, p1}, Ljava/util/Calendar;->setTime(Ljava/util/Date;)V

    .line 488
    iget-object v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->cal:Ljava/util/Calendar;

    const/16 v1, 0xb

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->hours:I

    .line 489
    iget-object v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->cal:Ljava/util/Calendar;

    const/16 v1, 0xc

    invoke-virtual {v0, v1}, Ljava/util/Calendar;->get(I)I

    move-result v0

    iput v0, p0, Ljavax/microedition/lcdui/TimeCanvas;->minutes:I

    .line 490
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TimeCanvas;->repaint()V

    .line 491
    return-void
.end method
